package com.gitee.wsl.doc.prosemirror.model.fragment.ext

import com.gitee.wsl.doc.prosemirror.model.content.ResolvedPos
import com.gitee.wsl.doc.prosemirror.model.fragment.Slice

fun Slice.fitsTrivially(_from: ResolvedPos, _to: ResolvedPos): Boolean {
    val slice = this
    return slice.openStart == 0 &&
            slice.openEnd == 0 &&
            _from.start() == _to.start() &&
            _from.parent.canReplace(_from.index(), _to.index(), slice.content)
}